import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'  

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   name: 'Home',
  // },
   {//个人中心
      path:"/",
      name:"Home",
        component:()=>import("../views/Home.vue"),
        beforeEnter:(to,from,next)=>{
            let login = window.sessionStorage.getItem("token");
            if(!login){
              next("/login");
              return;
            }else{
              next();
            }
      }
  },
  // {
  //   path: '/',
  //   name: 'videdetail',
  //   component: () => import('../components/base/videdetail.vue')
  // },
   
   {
    path: '/videdetail',
    name: 'videdetail',
    component: () => import('../components/base/videdetail.vue')
   },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../components/base/detail.vue')
  },
  {
    path: '/Home',
    name: 'Home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/classroom',
    name: 'classroom',
    component: () => import('../views/classroom.vue')
  },
  {
    path: '/cookbook',
    name: 'cookbook',
    component: () => import('../views/cookbook.vue')
  },
  {
    path: '/collect',
    name: 'collect',
    component: () => import('../views/collect.vue')
  },
  {
    path: '/pinglisto',
    name: 'pinglisto',
    component: () => import('../components/shping/pinglisto.vue')
  },
  // {
  //   path: '/',
  //   name: 'pinglisto',
  //   component: () => import('../components/shping/pinglisto.vue')
  // },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('../views/mine.vue')
  },
  // {
  //   path: '/',
  //   name: 'login',
  //   component: () => import('../components/base/login.vue')
  // },
  
  {
    path: '/login',
    name: 'login',
    component: () => import('../components/base/login.vue')
  },
  {
    path: '/Home/journal',
    name: 'journal',
    component: () => import('../components/base/journal.vue')
  },
  {
    path: '/cardlist',
    name: 'cardlist',
    component: () => import('../components/shping/cardlist.vue')
  },
  {
    path: '/menuilst',
    name: 'menuilst',
    component: () => import('../components/menulist/menuilst.vue')
  }, 
  {
    path: '/shopping',
    name: 'shopping',
    component: () => import('../views/shopping.vue')
  }, 
  {
    path: '/seek',
    name: 'seek',
    component: () => import('../components/base/seek.vue')
  }, 
  {
    path: '/bijixiangqing',
    name: 'bijixiangqing',
    component: () => import('../components/base/bijixiangqing.vue')
  }, 
  // {
  //   path: '/',
  //   name: 'bijixiangqing',
  //   component: () => import('../components/base/bijixiangqing.vue')
  // }, 
   
  {
    path: '/card',
    name: 'card',
    component: () => import('../components/shping/card.vue')
  },
  // {
  //   path: '/',
  //   name: 'card',
  //   component: () => import('../components/shping/card.vue')
  // },
  {
    path: '/cardgoto',
    name: 'cardgoto',
    component: () => import('../components/shping/cardgoto.vue')
  },
  {
    path: '/pingluntosv',
    name: 'pingluntosv',
    component: () => import('../components/base/pingluntosv')
  },
  // {
  //   path: '/',
  //   name: 'pingluntosv',
  //   component: () => import('../components/base/pingluntosv')
  // },
  {
    path: '/order',
    name: 'order',
    component: () => import('../components/shping/order.vue')
  },
  {
    path: '/adderss',
    name: 'adderss',
    component: () => import('../components/adderss.vue')
  },
  {
    path: '/addersto',
    name: 'addersto',
    component: () => import('../components/addersto.vue')
  },
  {
    path: '/addedlit',
    name: 'addedlit',
    component: () => import('../components/addedlit.vue')
  },
  // {
  //   path: '/',
  //   name: 'addedlit',
  //   component: () => import('../components/addedlit.vue')
  // },
  {
    path: '/addfrom',
    name: 'addfrom',
    component: () => import('../components/addfrom.vue')
  },
  {
    path: '/Edit',
    name: 'Edit',
    component: () => import('../components/Edit.vue')
  },
 
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes,
  linkActiveClass:"itemcon"
})

export default router
